import MusicManager from "../../../../MusicManager";
import { Killer } from "../../../funcObj/interface/HealthPoint";
import FlyerMissile from "../FlyerMissile";

const { ccclass, property } = cc._decorator;

@ccclass
export default class Howitzer extends FlyerMissile {

    @property(cc.Sprite)
    show: cc.Sprite = null;

    @property(cc.SpriteFrame)
    white: cc.SpriteFrame = null;

    @property([cc.SpriteFrame])
    howitzerColor: cc.SpriteFrame[] = [];

    frame: cc.SpriteFrame;

    protected preDispatch(): void {
        this.show.spriteFrame = this.white;
        this.frame = this.howitzerColor[this.base.player.playerId]
        this.tail.stop();
        MusicManager.instance.play(MusicManager.instance.howitzerFire, this.node);
    }

    protected afterLiftoff(): void {
        this.tail.play();
        this.show.spriteFrame = this.frame;
    }

    die(killer: Killer): void {
        MusicManager.instance.play(MusicManager.instance.howitzerBomb, this.node);
        super.die(killer)
    }

}
